package a.e.b.a;

import a.c.e;
import a.e.b.b.b;
import a.e.b.b.bb;
import a.e.b.b.fb;
import a.e.b.b.j;
import a.e.b.b.s;
import a.e.b.b.t;
import a.e.b.c.cb;
import a.e.b.c.o;
import a.j.jd;
import a.j.jg;
import a.j.ld;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.util.Collection;
import java.util.Iterator;

public abstract class i
  implements eb
{
  static final Object a = "y.io.graphml.graph2d.AbstractNodeRealizerSerializer.INDIRECT_REALIZER_DESERIALIZATION";
  static final Object b = "y.io.graphml.graph2d.AbstractNodeRealizerSerializer.CURRENT_REALIZER";
  static final Object d = "y.io.graphml.graph2d.AbstractNodeRealizerSerializer.KEEP_DEFAULT_LABELS";
  static Class e;
  static Class f;
  static Class g;
  public static int h;
  public static boolean i;
  
  public void a(ld paramld, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    boolean bool = i;
    int m = h;
    Node localNode1 = paramNode.getAttributes().getNamedItem("selected");
    if (!bool)
    {
      if ((localNode1 != null) && ("true".equals(localNode1.getNodeValue()))) {
        paramld.e(true);
      }
      localNode1 = paramNode.getAttributes().getNamedItem("visible");
    }
    if (!bool) {
      if ((localNode1 != null) && ("false".equals(localNode1.getNodeValue()))) {
        paramld.d(false);
      }
    }
    NodeList localNodeList = paramNode.getChildNodes();
    Node localNode2;
    label526:
    label531:
    label533:
    if (localNodeList != null)
    {
      localObject = "http://www.yworks.com/xml/graphml";
      if (!bool) {}
      j = !y.a(paramt, "y.io.graphml.input.DeserializationProperties.IGNORE_PORTS") ? 1 : 0;
      k = 0;
      label345:
      label356:
      label358:
      do
      {
        if (k >= localNodeList.getLength()) {
          break;
        }
        localNode2 = localNodeList.item(k);
        if (m != 0) {
          break label573;
        }
        if (!bool)
        {
          if (localNode2.getNodeType() == 1)
          {
            if (bool) {
              continue;
            }
            if (((String)localObject).equals(localNode2.getNamespaceURI()))
            {
              String str = localNode2.getLocalName();
              if (!bool) {
                if ("Geometry".equals(str)) {
                  y.a(localNode2, paramld);
                }
              }
              NamedNodeMap localNamedNodeMap;
              Node localNode3;
              if (!bool) {
                if ("Fill".equals(str))
                {
                  localNamedNodeMap = localNode2.getAttributes();
                  localNode3 = localNamedNodeMap.getNamedItem("hasColor");
                  if (!bool)
                  {
                    if ((localNode3 == null) || (!"false".equalsIgnoreCase(localNode3.getNodeValue()))) {
                      localNode3 = localNamedNodeMap.getNamedItem("color");
                    }
                  }
                  else
                  {
                    if (bool) {
                      break label358;
                    }
                    if (localNode3 == null) {
                      break label345;
                    }
                    paramld.a(y.a(localNode3.getNodeValue()));
                    if (bool) {
                      break label356;
                    }
                    if (m == 0) {
                      break label345;
                    }
                  }
                  paramld.a(null);
                  localNode3 = localNamedNodeMap.getNamedItem("color2");
                  if (!bool)
                  {
                    if (localNode3 != null) {
                      paramld.b(y.a(localNode3.getNodeValue()));
                    }
                    localNode3 = localNamedNodeMap.getNamedItem("transparent");
                  }
                  if (localNode3 != null) {
                    paramld.c("true".equalsIgnoreCase(localNode3.getNodeValue()));
                  }
                }
              }
              if (!bool) {
                if ("BorderStyle".equals(str))
                {
                  paramld.a(y.e(localNode2));
                  localNamedNodeMap = localNode2.getAttributes();
                  localNode3 = localNamedNodeMap.getNamedItem("hasColor");
                  if (!bool)
                  {
                    if ((localNode3 != null) && ("false".equalsIgnoreCase(localNode3.getNodeValue()))) {
                      break label526;
                    }
                    localNode3 = localNamedNodeMap.getNamedItem("color");
                    if (bool) {}
                  }
                  else
                  {
                    if (localNode3 == null) {
                      break label531;
                    }
                    paramld.c(y.a(localNode3.getNodeValue()));
                  }
                  if (bool) {
                    break label533;
                  }
                  if (m != 0) {
                    paramld.c(null);
                  }
                }
              }
              if (bool) {
                continue;
              }
              if (j != 0)
              {
                if (bool) {
                  continue;
                }
                if ("NodePorts".equals(str)) {
                  b(paramld, localNode2, paramt);
                }
              }
            }
          }
          k++;
        }
      } while (m == 0);
    }
    label573:
    Object localObject = bb.b(paramNode, "NodeLabel", "http://www.yworks.com/xml/graphml");
    if (!bool) {}
    int j = !((Collection)localObject).isEmpty() ? 1 : 0;
    if (!bool) {
      if (j == 0)
      {
        if (bool) {
          break label673;
        }
        if (y.a(paramt, d)) {
          break label666;
        }
      }
    }
    int k = paramld.x();
    do
    {
      if (k-- <= 0) {
        break;
      }
      paramld.a(k);
      if ((!bool) && (m != 0)) {
        return;
      }
    } while (m == 0);
    label666:
    if ((!bool) && (j != 0))
    {
      label673:
      Iterator localIterator = ((Collection)localObject).iterator();
      do
      {
        if (!localIterator.hasNext()) {
          break;
        }
        localNode2 = (Node)localIterator.next();
        c(paramld, localNode2, paramt);
      } while (m == 0);
    }
  }
  
  protected void b(ld paramld, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    boolean bool = i;
    int j = h;
    if (!bool) {}
    fb localfb = (fb)paramt.a(e == null ? (i.e = a("a.e.b.b.fb")) : e);
    String str = (String)localfb.get("y.io.graphml.input.CreationPropertyKeys.NODE_ID");
    if (!bool) {}
    s locals = (s)paramt.a(f == null ? (i.f = a("a.e.b.b.s")) : f);
    Node localNode1 = paramNode.getFirstChild();
    do
    {
      while (j == 0)
      {
        if (localNode1 == null) {
          break;
        }
        if (!bool)
        {
          if (localNode1.getNodeType() == 1)
          {
            if (bool) {
              continue;
            }
            if ("http://www.yworks.com/xml/graphml".equals(localNode1.getNamespaceURI()))
            {
              if (bool) {
                continue;
              }
              if ("NodePort".equals(localNode1.getLocalName()))
              {
                NamedNodeMap localNamedNodeMap = localNode1.getAttributes();
                Node localNode2 = localNamedNodeMap.getNamedItem("id");
                if (localNode2 == null) {
                  throw new a.e.b.b.a("Missing attribute id for element NodePort.");
                }
                a.e.b.n localn = locals.a(paramt, str, localNode2.getNodeValue());
                if (bool) {
                  continue;
                }
                if ((localn instanceof jd)) {
                  paramld.a((jd)localn);
                }
              }
            }
          }
          localNode1 = localNode1.getNextSibling();
        }
      }
    } while (bool);
  }
  
  protected void c(ld paramld, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    j localj = new j(paramt);
    localj.a(b, paramld);
    localj.a(paramNode);
  }
  
  public void b(ld paramld, cb paramcb, o paramo)
  {
    boolean bool = i;
    Object localObject = paramo.a("writeSelectionState");
    if (!bool)
    {
      if (Boolean.TRUE.equals(localObject)) {
        paramcb.a("selected", paramld.H());
      }
      localObject = paramo.a("writeVisibility");
    }
    if ((bool) || ((!Boolean.FALSE.equals(localObject)) && (!paramld.D()))) {
      paramcb.a("visible", paramld.D());
    }
  }
  
  public void a(ld paramld, cb paramcb, o paramo)
    throws a.e.b.c.a
  {
    boolean bool = i;
    int k = h;
    y.a(paramcb, paramld);
    a(paramcb, paramld);
    y.a(paramcb, "BorderStyle", paramld.r(), paramld.q());
    int j = 0;
    if (j < paramld.x()) {}
    while (bool)
    {
      a(paramld.b(j), paramcb, paramo);
      j++;
      if ((!bool) && (k != 0)) {
        return;
      }
      if (k == 0) {
        break;
      }
    }
    c(paramld, paramcb, paramo);
  }
  
  protected void c(ld paramld, cb paramcb, o paramo)
    throws a.e.b.c.a
  {
    boolean bool = i;
    int m = h;
    if (paramld.y() > 0)
    {
      if (!bool) {}
      a.e.b.c.n localn = (a.e.b.c.n)paramo.a(g == null ? (i.g = a("a.e.b.c.n")) : g);
      e locale = (e)paramo.b();
      paramcb.a("NodePorts", "http://www.yworks.com/xml/graphml");
      int j = 0;
      int k = paramld.y();
      do
      {
        if (j >= k) {
          break;
        }
        jd localjd = paramld.c(j);
        paramcb.a("NodePort", "http://www.yworks.com/xml/graphml");
        paramcb.c("id", localn.a(localjd, locale, paramo));
        paramcb.b();
        j++;
        if ((!bool) && (m != 0)) {
          return;
        }
      } while (m == 0);
      if (!bool) {
        paramcb.b();
      }
    }
  }
  
  protected void a(jg paramjg, cb paramcb, o paramo)
    throws a.e.b.c.a
  {
    paramo.b(paramjg);
  }
  
  protected void a(cb paramcb, ld paramld)
  {
    boolean bool = i;
    if (!bool)
    {
      paramcb.a("Fill", "http://www.yworks.com/xml/graphml");
      if (paramld.o() == null)
      {
        if (bool) {
          break label48;
        }
        paramcb.c("hasColor", "false");
        if (h == 0) {
          break label57;
        }
      }
    }
    label48:
    y.a(paramcb, "color", paramld.o());
    label57:
    if (paramld.p() != null) {
      y.a(paramcb, "color2", paramld.p());
    }
    paramcb.a("transparent", paramld.s());
    paramcb.b();
  }
  
  public boolean a(ld paramld, o paramo)
  {
    return paramld.getClass() == d();
  }
  
  public boolean a(Node paramNode, t paramt)
  {
    boolean bool = i;
    if (((bool) || (paramNode.getNodeType() == 1)) && ((bool) || (paramNode.getNamespaceURI().equals(b())))) {
      if (bool) {}
    }
    return paramNode.getLocalName().equals(a());
  }
  
  public ld b(Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    try
    {
      return (ld)d().newInstance();
    }
    catch (InstantiationException localInstantiationException)
    {
      throw new b("Unable to create instance of class " + d() + ": " + localInstantiationException.getMessage(), localInstantiationException);
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      throw new b("Unable to create instance of class " + d() + ": " + localIllegalAccessException.getMessage(), localIllegalAccessException);
    }
  }
  
  public String c()
  {
    return null;
  }
  
  static Class a(String paramString)
  {
    try
    {
      return Class.forName(paramString);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.e.b.a.i

 * JD-Core Version:    0.7.0.1

 */